package com.cskaoyan.controller.wx;


import com.cskaoyan.bean.catagoryWx.vo.CatalogIndexVo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.service.CatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx/catalog")
public class CatalogController {
    @Autowired
    CatalogService catalogService;

    @RequestMapping("index")
    public BaseRespVo indexCategory() {
        CatalogIndexVo catalogIndexVo = catalogService.querIndexCategory();
        BaseRespVo<Object> baseRespVo = new BaseRespVo<>();
        baseRespVo.setErrno(0);
        baseRespVo.setErrmsg("成功");
        baseRespVo.setData(catalogIndexVo);
        return baseRespVo;
    }

    @RequestMapping("current")
    public BaseRespVo currentCategory(Integer id) {
        CatalogIndexVo catalogIndexVo = catalogService.queryCurrentCategory(id);
        BaseRespVo<Object> baseRespVo = new BaseRespVo<>();
        baseRespVo.setErrno(0);
        baseRespVo.setErrmsg("成功");
        baseRespVo.setData(catalogIndexVo);
        return baseRespVo;
    }
}
